﻿Imports KanBan.Pgd.Infrastructure.Repositories
Imports KanBan.Pgd.Domain.ValueObjects
Imports KanBan.Pgd.Security
Imports KanBan.Pgd.Domain
Imports KanBan.Pgd.Common

Public Class PgdApp

    Public ReadOnly Property Users() As UserService
        Get
            Return New UserService()
        End Get
    End Property

    Public ReadOnly Property SearchRequests() As SearchRequestService
        Get
            Return New SearchRequestService()
        End Get
    End Property

    Public ReadOnly Property Profiles() As ProfileRepository
        Get
            Return New ProfileRepository()
        End Get
    End Property

    Public ReadOnly Property ProfileLevels() As ValueObjectRepository(Of ProfileLevel)
        Get
            Return New ValueObjectRepository(Of ProfileLevel)
        End Get
    End Property

    Public ReadOnly Property Priorities() As ValueObjectRepository(Of Priority)
        Get
            Return New ValueObjectRepository(Of Priority)
        End Get
    End Property

    Public ReadOnly Property RecruitmentTypes() As ValueObjectRepository(Of RecruitmentType)
        Get
            Return New ValueObjectRepository(Of RecruitmentType)
        End Get
    End Property

    Public ReadOnly Property KnowledgeLevels() As KnoledgeLevelExtension
        Get
            Return New KnoledgeLevelExtension
        End Get
    End Property

    Public ReadOnly Property Areas() As AreaRepository
        Get
            Return New AreaRepository()
        End Get
    End Property

    Public ReadOnly Property Candidates() As CandidateRepository
        Get
            Return New CandidateRepository()
        End Get
    End Property

    Public ReadOnly Property Competencies() As CompetencyRepository
        Get
            Return New CompetencyRepository()
        End Get
    End Property

    Public ReadOnly Property GoalDefinitions() As GoalDefinitionRepository
        Get
            Return New GoalDefinitionRepository()
        End Get
    End Property

    Public ReadOnly Property Goals() As GoalRepository
        Get
            Return New GoalRepository()
        End Get
    End Property

    Public ReadOnly Property Groups() As GroupRepository
        Get
            Return New GroupRepository()
        End Get
    End Property

    Public ReadOnly Property PerformanceEvaluations() As PerformanceEvaluationRepository
        Get
            Return New PerformanceEvaluationRepository()
        End Get
    End Property

    Public ReadOnly Property Permissions() As ValueObjectRepository(Of Permission)
        Get
            Return New ValueObjectRepository(Of Permission)
        End Get
    End Property

    Public ReadOnly Property Rooms() As RoomRepository
        Get
            Return New RoomRepository()
        End Get
    End Property

    Public Function Authenticate(ByVal userName As String, ByVal password As String) As Boolean

        'Dim user = Me.Users.GetByUserName(userName)
        'If user Is Nothing Then Return False

        'Dim hashedPassword As String = Encryption.EncryptMD5(password)

        'If user.IsCorrupted Then
        '    Throw New ApplicationException("The User Account you are trying to log in with has been modified outside the environment of the application. Contact the Administrator.")
        'End If

        'If password <> user.Password Then Return False

        'Dim userPermissions = Me.Users.GetAllPermissions(user.Id)

        'ClientSession.UserCredentials = New UserCredentials(user.Id, user.UserName, userPermissions)

        'EventLogger.Log(String.Format("User {0} has logged in successfully", user.UserName))

        'Return True

    End Function

End Class
